﻿<%@ Page Language="C#" Inherits="E.Web.Teacher.classes.Edit" %>
<%@ Import Namespace="E.Model" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
  <title>班级信息</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  <link rel="stylesheet" href="/css/main.css" type="text/css" media="all" />
  <link rel="stylesheet" href="/css/t_main.css" type="text/css" media="all" />
  <link rel="stylesheet" href="/css/class.css" type="text/css" media="all" />
  <link rel="stylesheet" href="/css/flora.datepick.css" type="text/css" media="all" />
  <script type="text/javascript" src="/js/Common.js"></script>
  <script type="text/javascript" src="/js/ajax.js"></script>
  <script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>
  <script type="text/javascript" src="/js/class.js"></script>
  <script type="text/javascript" src="/js/course.js"></script>
  <script type="text/javascript" src="/js/jquery.datepick.min.js"></script>
  <script type="text/javascript" src="/js/jquery.datepick-zh-CN.js"></script>
  <link rel="stylesheet" href="/css/main.css" type="text/css" media="all" />
  <link rel="stylesheet" href="/css/t_main.css" type="text/css" media="all" />
  <link href="/js/jquery-window-5.03/css/jquery.window.css" rel="stylesheet" type="text/css"/>
  <script src="http://code.jquery.com/ui/1.8.21/jquery-ui.min.js" type="text/javascript"></script>
  <script type="text/javascript" src="/js/jquery-window-5.03/jquery.window.js"> </script>
  <link href="/js/jquery-window-5.03/css/jquery.window.css" rel="stylesheet" type="text/css"/>

      <style type="text/css">
        a{color:#333;text-decoration:none;font-size:10pt;cursor:pointer; } 
        a:hover {color:#CC3300;text-decoration:underline;font-size:10pt;}
        #ui-datepicker-div {
          z-index: 9999999!important;
        }
    </style>
  <script type="text/javascript">
    $(document).ready(
      function() {
        $("#StartTimeTxt").datepick({ dateFormat: 'yy-mm-dd', showOn: 'button', buttonImage: '/images/icon/calendar-green.gif', buttonImageOnly: true });
        $("#EndTimeTxt").datepick({ dateFormat: 'yy-mm-dd', showOn: 'button', buttonImage: '/images/icon/calendar-green.gif', buttonImageOnly: true });
      }
    );
    function showStudentMenu() {
        var radSignUpType = $("[#radSUTReNo]:checked").val();
        var div = document.getElementById("divStudent");
        if (radSignUpType == 0) {
            div.style.display = "block";
        }
        else {
            div.style.display = "none";
        }

    }
    function getStudentByProject() {

        if ($("#CertificateSlt").val() == "-1") {
            alert("请选择项目组！");
            return;
        }
        var content = "<div id='searchStudent' style='padding:10px;'>";
        content = content + "<div style='float:left;'><div class='fl'><label style='font-size:10pt;'>登陆名(模糊查询):</label><input type='text' id='loginId' name='loginId'/></div></div>"
        content = content + "<div style='float:left;'><div class='fl' style='line-height:23px;font-size:10pt;'>入职时间：</div><div class='fl' style='font-size:10pt;'><input id='FromDateTxt' name='FromDateTxt' />&nbsp;至&nbsp;<input id='ToDateTxt' name='ToDateTxt' /></div></div>";
        content = content + "<div style='float:left;'><a id='btnSearch' onclick='initStudentList();' >下一步</a></div></div>";

       
        windowObj = $.window({
            //modalOpacity: 0.5,
            title: "指派学生",
            content: content, // load window_block2 html content
            draggable: true,
            resizable: true,
            minimizable: false,
            maximizable: false,
            showModal: true
        });
        $("#FromDateTxt").datepicker({ dateFormat: 'yy-mm-dd' });
        $("#ToDateTxt").datepicker({ dateFormat: 'yy-mm-dd' });
      
    }

    function initStudentList() {
        var selectProject = $("#CertificateSlt").val();
        var selectCourse = $("#CourseSlt").val();
        var selectAreaID = $("#AreaSlt").val();
        var url = "/tools/ajax.aspx?t=getPublicStudentByProject";
        var data = "v=" + selectProject + "&seleCourseId=" + selectCourse + "&seleAreaID=" + selectAreaID + "&entryFromDate=" + $("#FromDateTxt").val() + "&entryToDate=" + $("#ToDateTxt").val() + "&loginid=" + $("#loginId").val();
        $.ajax({
            url: url,
            data: data,
            aync: true,
            datatype: "text",
            type: "post",
            async: true,
            success: function (jsondata) {
                openStudentListWindow(jsondata);
            }
        });
    }

    function openStudentListWindow(jsondata) {
        windowObj.close();
        var searchResult = $("<div id='searchResult'></div>");
        var table = $("<table id='tableSearchResult'></table>");
        table.appendTo(searchResult);
        $("<tr class='HeadCell'><td class='HeadCell'></td><td class='HeadCell'>姓名</td><td class='HeadCell'>项目组</td><td class='HeadCell'>登录名</td></tr>").appendTo(table);
        var eachStudent;
        for (var i = 0; i < jsondata.length; i++) {
            eachStudent = jsondata[i];
            $("<tr><td class='ContentCell'><input type='checkbox' name='studentId' value='" + eachStudent.ID + "'/></td><td class='ContentCell'>" + eachStudent.UserName + "</td><td class='ContentCell'>" + eachStudent.SignedCertificateName + "</td><td class='ContentCell'>" + eachStudent.LoginID + "</td></tr>").appendTo(table);
        }
        var btnDiv = $("<div style='float:left;'></div>");
        btnDiv.appendTo(searchResult);
        $("<a id='btnAll' name='btnAll' onclick=\"selectAll('tableSearchResult');\">全选&nbsp;&nbsp;</a>").appendTo(btnDiv);
        $("<a id='btnInverse' name='btnInverse' onclick=\"inverseAll('tableSearchResult');\">反选&nbsp;&nbsp;</a>").appendTo(btnDiv);
        $("<a id='btnConfirm' name='btnConfirm' onclick=\"confirmArrayId('tableSearchResult','studentIdArray',';');\">确定</a>").appendTo(btnDiv);
        $.window({
            //modalOpacity: 0.5,
            title: "指派学生",
            content: searchResult, // load window_block2 html content
            draggable: true,
            resizable: false,
            minimizable: false,
            maximizable: false,
            showModal: true
        });
    }
  </script>
</head>
<body>
  <form id="form1" action="" method="post">
    <div class="m_top"></div>
    <div class="block">
      <div style="width:650px; height:22px;">
        <div class="title">&nbsp;班级信息填写</div>
      </div>
      <div class="spe_line_2"></div>
      <% if (act == "u") { %>
      <div class="box_1">
        <div class="fl tr left">班级编号：</div>
        <div class="fl dis_r"><%=model.ClassCode%></div>
      </div>
      <% } else { %>
      <div class="box_1">
        <div class="fl tr left"><span class="hint">*</span>班级编号：</div>
        <div class="fl"><input type="text" id="ClassCodeTxt" name="ClassCodeTxt" maxlength="50" value="<%=model.ClassCode %>" /></div>
      </div>
      <% } %>
      
      <div class="box_1">
        <div class="fl tr left"><span class="hint">*</span>最多人数：</div>
        <div class="fl"><input type="text" id="MaxCountTxt" name="MaxCountTxt" maxlength="50" value="<%=model.MaxCount %>" /></div>
      </div>
      <% if (act == "u") { %>
      <div class="box_1">
        <div class="fl tr left">当前人数：</div>
        <div class="fl dis_r"><%=model.CurrentCount %></div>
      </div>
      <div class="box_1">
        <div class="fl tr left">开班时间：</div>
        <div class="fl dis_r"><%=model.StartTime.ToShortDateString() %></div>
      </div>
      <div class="box_1">
        <div class="fl tr left">结束时间：</div>
        <div class="fl dis_r"><%=model.EndTime.ToShortDateString() %></div>
      </div>
      <div class="box_1">
        <div class="fl tr left">认证类别及课程：</div>
        <div class="fl dis_r"><%=model.CertificateName %>--<%=model.CourseName %></div>
      </div>
      <div class="box_1">
        <div class="fl tr left">培训机构：</div>
        <div class="fl dis_r"><%=model.AreaName %></div>
      </div>

      <% } else { %>
      <div class="box_1">
        <div class="fl tr left"><span class="hint">*</span>开班时间：</div>
        <div class="fl"><input type="text" id="StartTimeTxt" name="StartTimeTxt" maxlength="50" /></div>
      </div>
      <div class="box_1">
        <div class="fl tr left"><span class="hint">*</span>结束时间：</div>
        <div class="fl"><input type="text" id="EndTimeTxt" name="EndTimeTxt" maxlength="50" /></div>
      </div>
      <div class="box_1">
        <div class="fl tr left"><span class="hint">*</span>认证类别及课程：</div>
        <div class="fl">
          <% if (certificateList != null && certificateList.Count > 0) { %>
          <select id="CertificateSlt" name="CertificateSlt" onchange="GetCourseList(this.value);">
            <option value="-1">请选择认证类别</option>
            <% foreach (System.Collections.Generic.KeyValuePair<int, string> kvp in certificateList) { %>
              <option value="<%=kvp.Key %>"><%=kvp.Value%></option>
            <% } %>
          </select>
          <select id="CourseSlt" name="CourseSlt">
            <option value="-1">请选择课程</option>
          </select>
          <% } %>
        </div>
      </div>
      <div class="box_1">
        <div class="fl tr left"><span class="hint">*</span>培训机构：</div>
        <div class="fl">
          <% if (areaList != null && areaList.Count > 0) { %>
          <select id="AreaSlt" name="AreaSlt">
            <option value="-1">请选择</option>
            <% foreach (DictAreaModel areaModel in areaList) { %>
              <option value="<%=areaModel.ID %>"><%=areaModel.Name%></option>
            <% } %>
          </select>
          <% } %>
        </div>
      </div>
      <% } %>
       <div class="box_1">
            <div class="fl tr left">
                <span class="hint">*</span>报名方式：</div>
            <div class="fl">
                <input type="radio" name="radSignUpType" id="radSUTRe" value="2" onclick="showStudentMenu()"
                     <% 
                    if((act == "u" && (model.SignUpType == 2 || model.SignUpType == -2)) || act == "n")
                    {
                        Response.Write("checked='checked' ");
                    }
                 %> 
                    />需要报名（报名后需要审核）</div>
        </div>
        <div class="box_1">
            <div class="fl tr left">
            </div>
            <div class="fl">
                <input type="radio" name="radSignUpType" id="radSUTReCurr" value="1" onclick="showStudentMenu()" 
                 <% 
                    if((act == "u" && model.SignUpType == 1))
                    {
                        Response.Write("checked='checked' ");
                    }
                 %> 
                
                />直接开班（报名后无需审核）</div>
        </div>
        <div class="box_1">
            <div class="fl tr left">
            </div>
            <div class="fl">
                <input type="radio" name="radSignUpType" id="radSUTReNo" value="0" onclick="showStudentMenu()" 
                 <% 
                    if((act == "u" && model.SignUpType == 0))
                    {
                        Response.Write("checked='checked' ");
                    }
                 %> 
                />不需要报名（管理员直接选定学员开班）</div>
        </div>
        <div id="divStudent" class="box_1" style="display: none">
            <div class="fl tr left">
            </div>
            <div class="fl">
                <a id="A1" onclick="getStudentByProject();">&nbsp;&nbsp;&nbsp;分配学生(<span
                    class="hint">请指定学员</span>)</a></div>
        </div>
      <input type="hidden" id="act" name="act" value="<%=act %>" />
      <input type="hidden" id="id" name="id" value="<%=id %>" />
     <input type="hidden" name="studentIdArray" id="studentIdArray" />
      <div style="width:350px; margin-top:20px; text-align:center;">
        <input type="image" src="/images/btn/confirm.gif" style="width:52px; height:22px;" onclick="return CheckClassForm();" />
        <% if (act == "u") { %>
        &nbsp;&nbsp;<a href="/classes/ClassList.aspx"><img alt="" src="/images/btn/back.gif" /></a>
        <% } %>
      </div>
    </div>
  </form>
  
  <%--<% if (act == "u") { %>
  <script type="text/javascript">
    document.getElementById("AreaSlt").value = <%=model.AreaID %>;
    document.getElementById("CertificateSlt").value = <%=model.CertificateID %>;
    GetCourseList(<%=model.CertificateID %>, <%=model.CourseRelationID %>);
  </script>
  <% } %>--%>
</body>
</html>
